﻿static class MiscUtils
{
	public static System.IAsyncResult BeginInvokeEx( this System.Windows.Forms.Control ctl, System.Action act )
	{
		if( null == ctl ) return null;
		if( ctl.IsDisposed ) return null;
		if( !ctl.IsHandleCreated ) return null;
		return ctl.BeginInvoke( act );
	}

	public static System.IAsyncResult BeginInvokeEx( this System.Windows.Forms.Control ctl, System.Action<object> act, object param )
	{
		if( null == ctl ) return null;
		if( ctl.IsDisposed ) return null;
		if( !ctl.IsHandleCreated ) return null;
		return ctl.BeginInvoke( new System.Threading.ParameterizedThreadStart( act ), param );
	}
}
